var app = getApp();
const pathUrl = app.globalData.pathUrl;
Page({
  /**
   * 页面的初始数据
   */
  data: {
    mobile: '', // 手机号
    smsCode: '', // 短信验证码
    smsCodeStatus: true, // 是否能点击获取验证码的状态判断
    smsCodeTxt: '获取验证码',
    smsCodeTime: 60, // 60s倒计时
    showSmsCodeBtn: false, // 显示获取验证码按钮
    loginBtnStatus: false, // 是否能点击登陆按钮的状态判断
    isCheck: false, // 是否阅读并同意协议
    tabIndex: '0', // 切换个人登陆/企业登陆
    list02: []
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(e) {
    wx.getUserInfo({
      success: res => {
        app.globalData.userInfo = res.userInfo
        this.setData({
          userInfo: res.userInfo,
          hasUserInfo: true
        })
      }
    })
    var logs = wx.getStorageSync('logs') || []
    logs.unshift(Date.now())
    wx.setStorageSync('logs', logs)
    // 登录
    wx.login({
      success: res => {
        console.log(res)
        wx.setStorageSync('jscode', res.code)
        // 发送 res.code 到后台换取 openId, sessionKey, unionId
      }
    })

  },
  
  // 切换个人登陆/企业登陆
  tabFac: function(e) {
    console.log(e);
    let that = this;
    that.setData({
      tabIndex: e.currentTarget.dataset.index
    });
  },
  // 手机号码
  mobileInput: function(e) {
    var mobile = e.detail.value;
    if (mobile) {
      this.setData({
        mobile: mobile,
        showSmsCodeBtn: true
      });
    } else {
      this.setData({
        showSmsCodeBtn: false
      });
    }
    this.changeLoginBtnStatus();
  },
  idCardNumInput: function() {

  },
  // 短信验证码
  smsCodeInput: function(e) {
    var smsCode = e.detail.value;
    this.setData({
      smsCode: smsCode
    });
    this.changeLoginBtnStatus();
  },
  // 获取短信验证码 
  getSmsCode: function() {
    if (!this.data.mobile) {
      wx.showToast({
        title: '正在获取',
        duration: 1000
      });
      return;
    } else {
      if (this.data.mobile.length == 11) {
        var telReg = /^[1]([3-9])[0-9]{9}$/;
        if (!telReg.test(this.data.mobile)) {
          wx.showToast({
            title: '手机号不正确',
            duration: 1000
          });
          return;
        } else {
          wx.showLoading({
            title: '正在请求',
          });
          let that = this;
          wx.request({
            url: pathUrl + '/sys/sms',
            method: "POST",
            data: {
              mobile: that.data.mobile,
              smsmode: '0'
            },
            success: function(res) {
              console.log(res);
              if (res.data.success) {
                console.log(res.data.success)
                wx.hideLoading();
                wx.showToast({
                  title: '发送成功',
                  icon: 'success',
                  duration: 1000
                });
                var timer = setInterval(function() {
                  if (that.data.smsCodeTime > 0) {
                    that.setData({
                      smsCodeStatus: false, // 是否能点击获取验证码的状态判断
                      smsCodeTxt: '剩余' + (that.data.smsCodeTime - 1) + '秒',
                      smsCodeTime: that.data.smsCodeTime - 1, // 60s倒计时
                    });
                  } else {
                    clearInterval(timer);
                    that.setData({
                      smsCodeTime: 60,
                      smsCodeTxt: '获取验证码',
                      smsCodeStatus: true
                    });
                  }
                }, 1000);
              } else {
                wx.showToast({
                  title: '验证码发送失败',
                  icon: "none",
                  duration: 1000
                });
              }
            },
            fail: function(res) {
              wx.showToast({
                title: '发送失败',
                icon: 'loading',
                duration: 1000
              });
            }
          });
        }
      } else {
        wx.showToast({
          title: '手机号不正确',
          duration: 1000
        })
        return;
      }
    }
  },
  // 验证码
  smsCode: function() {
    var that = this;
    var timer = setInterval(function() {
      if (that.data.smsCodeTime > 0) {
        that.setData({
          smsCodeStatus: false, // 是否能点击获取验证码的状态判断
          smsCodeTxt: '剩余' + (that.data.smsCodeTime - 1) + '秒',
          smsCodeTime: that.data.smsCodeTime - 1, // 60s倒计时
        });
      } else {
        clearInterval(timer);
        that.setData({
          smsCodeTime: 60,
          smsCodeTxt: '获取验证码',
          smsCodeStatus: true
        });
      }
    }, 1000);
  },
  // 是否阅读并同意协议
  xieyi: function(e) {
    console.log(e.detail.value)
    if (e.detail.value == '') {
      this.setData({
        isCheck: false
      });
    } else {
      this.setData({
        isCheck: true
      });
    }
    this.changeLoginBtnStatus();
  },
  // 改变登陆按钮状态
  changeLoginBtnStatus: function() {
    if (this.data.mobile && this.data.smsCode && this.data.isCheck) {
      this.setData({
        loginBtnStatus: true
      });
    } else {
      this.setData({
        loginBtnStatus: false
      });
    }
  },
  // getUserInfo: function(e) {
  
  // },
  getUserInfo: function (e) {
    var that = this;
    console.log(e)
    var userInfo = e.detail.rawData
    var userInfo = JSON.parse(userInfo)
    console.log(userInfo)
    wx.setStorageSync("userInfo", userInfo)
    var that = this;
    // wx.navigateTo({
    //   url: '../login/login'
    // })
    var userInfo = wx.getStorageSync('userInfo')
    that.setData({
      userInfo: userInfo
    })
    if (that.data.mobile == null || that.data.mobile == '') {
      wx.showModal({
        title: '提示',
        content: '请输入手机号码',
        showCancel: false,
      })
      return false;
    }
    if (that.data.smsCode == null || that.data.smsCode == '') {
      wx.showModal({
        title: '提示',
        content: '请输入验证码',
        showCancel: false,
      })
      return false;

    }
    if (!that.data.loginBtnStatus) {
      wx.showModal({
        title: '提示',
        content: '请勾选同意协议',
        showCancel: false,
      })
      return false;
    }

    wx.showLoading({
      title: '正在登陆',
    });
    if (that.data.loginBtnStatus) {
      wx.request({
        url: pathUrl + '/sys/phoneLogin',
        method: 'POST',
        data: {
          mobile: that.data.mobile,
          captcha: that.data.smsCode
        },
        success: function (res) {
          console.log(res)
          console.log(res.data.code);
          wx.hideLoading();
          var telphone = that.data.mobile;
          wx.setStorageSync('telphone', telphone);
          console.log(telphone)
          if(res.data.success){
            wx.request({
              url: pathUrl + '/gzgl/fxyGzgl02/list',
              method: 'GET',
              data: {
                query12: telphone,
              },
              success: function (res) {
                console.log(res)
                console.log(res.data.result.records);
                if (res.data.result.records.length == '0') {
                  wx.showModal({
                    title: '提示',
                    content: '请联系管理员后台添加信息',
                    showCancel: false
                  })
                }
                var list = res.data.result.records;
                console.log(list[0].query07)
                wx.setStorageSync('orderNo', list[0].query07);
                wx.setStorageSync('userId', list[0].query20);
                var userId = list[0].query20;
                var orderNo = list[0].query07;

                that.setData({
                  list02: list,
                  userId: userId,
                  orderNo: orderNo
                })
                console.log(that.data.list02)
                console.log(list[0].query01)
                if (userId == null || userId == '') {
                  var data = {
                    createBy: list[0].createBy,
                    createTime: list[0].createTime,
                    id: list[0].id,
                    query01: list[0].query01,
                    query02: list[0].query02,
                    query03: list[0].query03,
                    query04: list[0].query04,
                    query05: list[0].query05,
                    query06: list[0].query06,
                    query07: list[0].query07,
                    query08: list[0].query08,
                    query09: list[0].query09,
                    query10: list[0].query10,
                    query11: list[0].query11,
                    query12: list[0].query12,
                    query13: list[0].query13,
                    query14: list[0].query14,
                    query15: list[0].query15,
                    query16: list[0].query16,
                    query17: list[0].query17,
                    query18: list[0].query18,
                    query19: list[0].query19,
                    query20: list[0].query20,
                    query21: list[0].query21,
                    query22: list[0].query22,
                    query23: list[0].query23,
                    query24: list[0].query24,
                    query25: list[0].query25,
                    query26: list[0].query26,
                    query27: list[0].query27,
                    query28: list[0].query28,
                    query29: list[0].query29,
                    query30: list[0].query30,
                    query31: list[0].query31,
                    query32: list[0].query32,
                    query33: list[0].query33,
                    query34: list[0].query34,
                    query35: list[0].query35,
                    query36: list[0].query36,
                    query37: list[0].query37,
                    query38: list[0].query38,
                    query39: 'Y',
                    sysOrgCode: list[0].sysOrgCode,
                    updateBy: list[0].updateBy,
                    updateTime: list[0].updateTime
                  }
                  console.log(data)
                  wx.request({
                    url: pathUrl + '/gzgl/fxyGzgl02/edit',
                    method: 'PUT',
                    data: data,
                    success: function (res) {
                      console.log(res)
                      wx.request({
                        url: pathUrl + '/gzgl/fxyGzgl02/list',
                        method: 'GET',
                        data: {
                          query12: telphone,
                        },
                        success: function (res) {
                          console.log(res)
                          var list = res.data.result.records;
                          wx.setStorageSync('orderNo', list[0].query07);
                          wx.setStorageSync('userId', list[0].query20);
                        },
                        fail: function (res) { }
                      });

                    },
                    fail: function (res) { }
                  });
                }
                wx.request({
                  url: pathUrl + '/gzgl/fxyGzgl04/list',
                  method: 'GET',
                  data: {
                    query07: orderNo,
                  },
                  success: function (res) {
                    console.log(res)
                    console.log(res.data.result.records);
                    var list04 = res.data.result.records;
                    wx.setStorageSync('caseNumber', list04[0].query16);
                    wx.setStorageSync('writNumber', list04[0].query17);
                    that.setData({
                      list04: list04,
                    })
                    if (list04[0].query16 == null || list04[0].query16 == '' || list04[0].query17 == null || list04[0].query17 == '') {
                      var data04 = {
                        createBy: list04[0].createBy,
                        createTime: list04[0].createTime,
                        id: list04[0].id,
                        query01: list04[0].query01,
                        query02: list04[0].query02,
                        query03: list04[0].query03,
                        query04: list04[0].query04,
                        query05: list04[0].query05,
                        query06: list04[0].query06,
                        query07: list04[0].query07,
                        query08: list04[0].query08,
                        query09: list04[0].query09,
                        query10: list04[0].query10,
                        query11: list04[0].query11,
                        query12: list04[0].query12,
                        query13: list04[0].query13,
                        query14: list04[0].query14,
                        query15: list04[0].query15,
                        query16: list04[0].query16,
                        query17: list04[0].query17,
                        query18: list04[0].query18,
                        query19: list04[0].query19,
                        query20: list04[0].query20,
                        query21: list04[0].query21,
                        query22: list04[0].query22,
                        query23: list04[0].query23,
                        query24: list04[0].query24,
                        query25: list04[0].query25,
                        query26: list04[0].query26,
                        query27: list04[0].query27,
                        query28: list04[0].query28,
                        query29: list04[0].query29,
                        query30: list04[0].query30,
                        query31: list04[0].query31,
                        query32: list04[0].query32,
                        query33: list04[0].query33,
                        query34: list04[0].query34,
                        query35: list04[0].query35,
                        query36: list04[0].query36,
                        query37: list04[0].query37,
                        query38: list04[0].query38,
                        query39: 'Y',
                        sysOrgCode: list04[0].sysOrgCode,
                        updateBy: list04[0].updateBy,
                        updateTime: list04[0].updateTime
                      }
                      var orderNo = wx.getStorageSync('orderNo')
                      console.log(orderNo)
                      wx.request({
                        url: pathUrl + '/gzgl/fxyGzgl01/list',
                        method: 'GET',
                        data: {
                          query07: orderNo,
                        },
                        success: function (res) {
                          console.log(res.data.result.records)
                          var list01 = res.data.result.records;
                          var data01 = {
                            // createTime: list01[0].createTime,
                            id: list01[0].id,
                            query01: list01[0].query01,
                            query02: list01[0].query02,
                            query03: list01[0].query03,
                            query04: list01[0].query04,
                            query05: list01[0].query05,
                            query06: list01[0].query06,
                            query07: list01[0].query07,
                            query08: list01[0].query08,
                            query09: list01[0].query09,
                            query10: list01[0].query10,
                            query11: list01[0].query11,
                            query12: list01[0].query12,
                            query13: list01[0].query13,
                            query14: list01[0].query14,
                            query15: list01[0].query15,
                            query16: list01[0].query16,
                            query17: list01[0].query17,
                            query18: list01[0].query18,
                            query19: list01[0].query19,
                            query20: list01[0].query20,
                            query21: list01[0].query21,
                            query22: list01[0].query22,
                            query23: list01[0].query23,
                            query24: list01[0].query24,
                            query25: list01[0].query25,
                            query26: list01[0].query26,
                            query27: list01[0].query27,
                            query28: list01[0].query28,
                            query29: list01[0].query29,
                            query30: list01[0].query30,
                            query31: list01[0].query31,
                            query32: list01[0].query32,
                            query33: list01[0].query33,
                            query34: list01[0].query34,
                            query35: list01[0].query35,
                            query36: list01[0].query36,
                            query37: list01[0].query37,
                            query38: list01[0].query38,
                            query39: 'Y',
                            sysOrgCode: list01[0].sysOrgCode,
                            updateBy: list01[0].updateBy,
                            updateTime: list01[0].updateTime
                          }
                          wx.request({
                            url: pathUrl + '/gzgl/fxyGzgl01/edit',
                            method: 'PUT',
                            data: data01,
                            success: function (res) {
                              console.log(res)
                            },
                            fail: function (res) { }
                          });
                        },
                        fail: function (res) { }
                      });
                    }
                  }
                })
                if (res.data.success) { // 登陆成功
                  console.log(JSON.stringify(res.data.result))
                  console.log(res.data.result.records[0].query22)

                  wx.setStorageSync('loginInfo', JSON.stringify(res.data.result));
                  wx.setStorageSync('realName', res.data.result.records[0].query13);

                  wx.setStorageSync('sfsm', res.data.result.records[0].query22);
                  if (res.data.result.records[0].query22 == '未实名' || res.data.result.records[0].query22 == null){
                    wx.showLoading();
                    wx.navigateTo({
                      url: '/pages/realname/realname',
                    })
                  }else{
                    wx.reLaunch({
                      url: "/pages/index/index"
                    })
                  }
                 
                } else { // 登陆失败
                  wx.showToast({
                    title: res.data.message,
                    icon: 'fail',
                    duration: 1000
                  });
                }
              },
              fail: function (res) { },

            });
          }else{
            wx.showModal({
              title: '提示',
              content: res.data.message,
              showCancel:false,
            })
            return false
          }
       
        

        },
        fail: function (res) {
          wx.showModal({
            title: '提示',
            content: '验证码错误或您的手机未注册',
            showCancel:false
          })
         }
      });
    }
    // 发送 res.code 到后台换取 openId, sessionKey, unionId

  },
  // 登陆
  // loginBtn: function() {
  //   var that = this;
  //   if (that.data.mobile == null || that.data.mobile == '') {
  //     wx.showModal({
  //       title: '提示',
  //       content: '请输入手机号码',
  //       showCancel: false,
  //     })
  //     return false;
  //   }
  //   if (that.data.smsCode == null || that.data.smsCode == '') {
  //     wx.showModal({
  //       title: '提示',
  //       content: '请输入验证码',
  //       showCancel: false,
  //     })
  //     return false;

  //   }
  //   if (!that.data.loginBtnStatus) {
  //     wx.showModal({
  //       title: '提示',
  //       content: '请勾选同意协议',
  //       showCancel: false,
  //     })
  //     return false;
  //   }
  //   wx.showLoading({
  //     title: '正在登陆',
  //   });
  //   if (that.data.loginBtnStatus) {
  //     wx.request({
  //       url: pathUrl + '/sys/phoneLogin',
  //       method: 'POST',
  //       data: {
  //         mobile: that.data.mobile,
  //         captcha: that.data.smsCode
  //       },
  //       success: function(res) {
  //         console.log(res);
  //         wx.hideLoading();
  //         var telphone = that.data.mobile;
  //         wx.setStorageSync('telphone', telphone);
  //         console.log(telphone)
  //         wx.request({
  //           url: pathUrl + '/gzgl/fxyGzgl02/list',
  //           method: 'GET',
  //           data: {
  //             query12: telphone,
  //           },
  //           success: function (res) {
  //             console.log(res)
  //             console.log(res.data.result.records);
  //             if (res.data.result.records.length =='0'){
  //               wx.showModal({
  //                 title: '提示',
  //                 content: '请联系管理员后台添加信息',
  //                 showCancel:false
  //               })
  //             }
  //             var list = res.data.result.records;
  //             console.log(list[0].query07)
  //             wx.setStorageSync('orderNo', list[0].query07);
  //             wx.setStorageSync('userId', list[0].query20);
  //             var userId = list[0].query20;
  //             that.setData({
  //               list02: list,
  //               userId: userId
  //             })
  //             console.log(that.data.list02)
  //             console.log(list[0].query01)
  //             if (userId == null || userId == '') {
  //               var data = {
  //                 createBy: list[0].createBy,
  //                 createTime: list[0].createTime,
  //                 id: list[0].id,
  //                 query01: list[0].query01,
  //                 query02: list[0].query02,
  //                 query03: list[0].query03,
  //                 query04: list[0].query04,
  //                 query05: list[0].query05,
  //                 query06: list[0].query06,
  //                 query07: list[0].query07,
  //                 query08: list[0].query08,
  //                 query09: list[0].query09,
  //                 query10: list[0].query10,
  //                 query11: list[0].query11,
  //                 query12: list[0].query12,
  //                 query13: list[0].query13,
  //                 query14: list[0].query14,
  //                 query15: list[0].query15,
  //                 query16: list[0].query16,
  //                 query17: list[0].query17,
  //                 query18: list[0].query18,
  //                 query19: list[0].query19,
  //                 query20: list[0].query20,
  //                 query21: list[0].query21,
  //                 query22: list[0].query22,
  //                 query23: list[0].query23,
  //                 query24: list[0].query24,
  //                 query25: list[0].query25,
  //                 query26: list[0].query26,
  //                 query27: list[0].query27,
  //                 query28: list[0].query28,
  //                 query29: list[0].query29,
  //                 query30: list[0].query30,
  //                 query31: list[0].query31,
  //                 query32: list[0].query32,
  //                 query33: list[0].query33,
  //                 query34: list[0].query34,
  //                 query35: list[0].query35,
  //                 query36: list[0].query36,
  //                 query37: list[0].query37,
  //                 query38: list[0].query38,
  //                 query39: 'Y',
  //                 sysOrgCode: list[0].sysOrgCode,
  //                 updateBy: list[0].updateBy,
  //                 updateTime: list[0].updateTime
  //               }
  //               console.log(data)
  //               wx.request({
  //                 url: pathUrl + '/gzgl/fxyGzgl02/edit',
  //                 method: 'PUT',
  //                 data: data,
  //                 success: function (res) {
  //                   console.log(res)
  //                   wx.request({
  //                     url: pathUrl + '/gzgl/fxyGzgl02/list',
  //                     method: 'GET',
  //                     data: {
  //                       query12: telphone,
  //                     },
  //                     success: function (res) {
  //                       console.log(res)
  //                       wx.setStorageSync('orderNo', list[0].query07);
  //                       wx.setStorageSync('userId', list[0].query20);
  //                     },
  //                     fail: function (res) { }
  //                   });

  //                 },
  //                 fail: function (res) { }
  //               });
  //             }
           
  //             if (res.data.success) { // 登陆成功
  //               console.log(JSON.stringify(res.data.result))
  //               console.log(res.data.result.records[0].query22)

  //               wx.setStorageSync('loginInfo', JSON.stringify(res.data.result));
  //               wx.setStorageSync('realName', res.data.result.records[0].query13);

  //               wx.setStorageSync('sfsm', res.data.result.records[0].query22);

  //               wx.reLaunch({
  //                 url: "/pages/index/index"
  //               })
  //             } else { // 登陆失败
  //               wx.showToast({
  //                 title: res.data.message,
  //                 icon: 'fail',
  //                 duration: 1000
  //               });
  //             }
  //           },
  //           fail: function (res) { },

  //         });
         
  //       },
  //       fail: function(res) {}
  //     });
  //   }
  //   // this.getUserInfo();
  // },
  getPhoneNumber: function(e) {
    console.log('sdas')
    console.log(e)
    // console.log(e.detail.errMsg);
    // console.log(e.detail.iv);
    // console.log(e.detail.encryptedData);
    var that = this;
    wx.request({
      url: pathUrl + '/tenPayController/authv6',
      data: {
        // 'JSCODE':that.data.codeA,
        'JSCODE': wx.getStorageSync('jscode'),
        'appCode': 'fxjct',
        'iv': e.detail.iv,
        'encryptedData': e.detail.encryptedData
      },
      success: function(e) {
        console.log(e)
        wx.setStorageSync('openId', e.data.message);

        var e = JSON.parse(e.data.result);

        wx.setStorageSync('telphone', e.phoneNumber);
        console.log(e);
        that.setData({
          mobile: e.phoneNumber,
          showSmsCodeBtn: true,
        })
        
      
      }
    })
  },
  getList02: function() {
    var that = this;
    var telphone = wx.getStorageSync('telphone')
    console.log(telphone)
    wx.request({
      url: pathUrl + '/gzgl/fxyGzgl02/list',
      method: 'GET',
      data: {
        query12: telphone,
      },
      success: function(res) {
        console.log(res)
        console.log(res.data.result.records);
        var list = res.data.result.records;
        console.log(list[0].query07)
        wx.setStorageSync('orderNo', list[0].query07);
        wx.setStorageSync('userId', list[0].query20);
        var userId = list[0].query20;
        that.setData({
          list02: list,
          userId: userId
        })
        console.log(that.data.list02)
        console.log(list[0].query01)
        if (userId == null || userId == '') {
          var data = {
            createBy: list[0].createBy,
            createTime: list[0].createTime,
            id: list[0].id,
            query01: list[0].query01,
            query02: list[0].query02,
            query03: list[0].query03,
            query04: list[0].query04,
            query05: list[0].query05,
            query06: list[0].query06,
            query07: list[0].query07,
            query08: list[0].query08,
            query09: list[0].query09,
            query10: list[0].query10,
            query11: list[0].query11,
            query12: list[0].query12,
            query13: list[0].query13,
            query14: list[0].query14,
            query15: list[0].query15,
            query16: list[0].query16,
            query17: list[0].query17,
            query18: list[0].query18,
            query19: list[0].query19,
            query20: list[0].query20,
            query21: list[0].query21,
            query22: list[0].query22,
            query23: list[0].query23,
            query24: list[0].query24,
            query25: list[0].query25,
            query26: list[0].query26,
            query27: list[0].query27,
            query28: list[0].query28,
            query29: list[0].query29,
            query30: list[0].query30,
            query31: list[0].query31,
            query32: list[0].query32,
            query33: list[0].query33,
            query34: list[0].query34,
            query35: list[0].query35,
            query36: list[0].query36,
            query37: list[0].query37,
            query38: list[0].query38,
            query39: 'Y',
            sysOrgCode: list[0].sysOrgCode,
            updateBy: list[0].updateBy,
            updateTime: list[0].updateTime
          }
          console.log(data)
          wx.request({
            url: pathUrl + '/gzgl/fxyGzgl02/edit',
            method: 'PUT',
            data: data,
            success: function(res) {
              console.log(res)
              wx.request({
                url: pathUrl + '/gzgl/fxyGzgl02/list',
                method: 'GET',
                data: {
                  query12: telphone,
                },
                success: function(res) {
                  console.log(res)
                  wx.setStorageSync('orderNo', list[0].query07);
                  wx.setStorageSync('userId', list[0].query20);
                },
                fail: function(res) {}
              });

            },
            fail: function(res) {}
          });
        }
      
        // if (res.data.success) { // 登陆成功
        //   wx.setStorageSync('loginInfo', JSON.stringify(res.data.result));
        //   wx.navigateTo({
        //     url: "/pages/index/index"
        //   })
        // } else { // 登陆失败
        //   wx.showToast({
        //     title: res.data.message,
        //     icon: 'fail',
        //     duration: 1000
        //   });
        // }
      },
      fail: function(res) {},


    });
  },
  editList02: function() {
    var that = this;
    var list = [];
    var list = that.data.list02
    console.log(that.data.list02)
    // console.log(list[0].query07)
    console.log(list)

  },

  //前往注册
  regBtn: function() {
    wx.navigateTo({
      url: '../register/register'
    })
  },









  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function() {
    // wx.downloadFile({
    //   url: 'https://www.zhaodui.com.cn/pic/appId.pdf',
    //   success: function (res) {
    //     var filePath = res.tempFilePath
    //     wx.openDocument({
    //       filePath: filePath,
    //       success: function (res) {
    //         console.log('打开文档成功')
    //       }
    //     })
    //   }
    // });
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function() {
    // var loginInfo = wx.getStorageSync('loginInfo')
    // console.log(loginInfo)
    // if (loginInfo ==''|| loginInfo == null){
    //   wx.navigateTo({
    //     url: '/pages/index1/index1',
    //   })
    // }
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function() {

  }
})